package org.demo.dao;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
 
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import org.demo.entity.SysUser;
import org.hibernate.Session;
import org.hibernate.SessionFactory ;

 

public class BaseDaoTest extends HibernateDaoSupport{
	
	public void showSession(){
		 
		SessionFactory sf = (SessionFactory) this.getHibernateTemplate().getSessionFactory();
		
		System.out.println(sf);
	}
	public static void main(String[] args) {
		ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
		SessionFactory sf = (SessionFactory)ctx.getBean("sessionFactory");
		Session s= sf.openSession();
		 SysUser user= (SysUser)s.get(SysUser.class, 3L);
		 sf.close();
		 System.out.println(user.getUsrName());
	}
}
